package reflect;

import reflect.annotation.AutoRunClass;

import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) throws Exception{
        Scanner scan=new Scanner(System.in);
        System.out.println("请输入一个类名");
        String className=scan.nextLine();
        Class cls = Class.forName(className);
        boolean mark=cls.isAnnotationPresent(AutoRunClass.class);
        if( mark)
        {
            System.out.println("有注解");
            Object obj = cls.newInstance();
            System.out.println(obj);
        }else {
            System.out.println("没有注解");
        }

    }

}
